
package msu.ml.core.xml;

import msu.ml.core.*;
import msu.ml.data.*;
import msu.ml.data.level2.*;
import javax.xml.parsers.*;
import org.w3c.dom.*;

/**
 * @author Reginald M Mead
 * @version 1.0
 */
public class Level2DataLoaderParser implements IDataLoaderParser
{
	public IDataLoader parse(Element element)
   {
      Level2DataLoader loader = new Level2DataLoader();
      /*NodeList nodes = element.getChildNodes(); 
      for(int i = 1; i < nodes.getLength(); i++)
      {
         Node node = nodes.item(i);
         if(node.getNodeName().equals("basic_pulse_volume_factory"))
         {
            loader.setPulseVolumeFactory(new BasicPulseVolumeFactory());

            if(ApplicationSettings.getInstance().getConfig("verbose").equals("true"))
               System.out.println("Using Basic Pulse Volume Factory");
         }
         else if(node.getNodeName().equals("spatial_pulse_volume_factory"))
         {
            loader.setPulseVolumeFactory(new SpatialPulseVolumeFactory());

            if(ApplicationSettings.getInstance().getConfig("verbose").equals("true"))
               System.out.println("Using Spatial Pulse Volume Factory");
         }
         else if(node.getNodeName().equals("extended_pulse_volume_factory"))
         {
            int kernelSize = Integer.parseInt(
               ((Element)node).getAttribute("kernel_size"));
            int depth = Integer.parseInt(
               ((Element)node).getAttribute("depth"));

            loader.setPulseVolumeFactory(
               new ExtendedPulseVolumeFactory(kernelSize, depth));

            if(ApplicationSettings.getInstance().getConfig("verbose").equals("true"))
            {
               System.out.println("Using Extended Pulse Volume Factory");
               System.out.print("\tWindow Size = " + kernelSize + " : ");
               System.out.println("Depth = " + depth);
            }
         }
      }*/

      //loader.setDepth(Integer.parseInt(element.getAttribute("depth")));
      return loader;
   }
}
